package com.ywx.yypicturebackend.model.enums;

import cn.hutool.core.util.ObjectUtil;
import lombok.Getter;

/**
 * 审核状态枚举
 */
@Getter
public enum PictureReviewStatusEnum {


    REVIEWING("待审核", 0),
    PASS("通过", 1),
    REJECT("拒绝", 2);



    private final String text;


    private final Integer value;

    PictureReviewStatusEnum(String text, Integer value) {
        this.text = text;
        this.value = value;
    }

    /**
     * 根据值获取枚举
     * @param value
     * @return
     */
    public static PictureReviewStatusEnum getEnumByValue(Integer value){

        if(ObjectUtil.isEmpty(value)){
            return null;
        }

        for (PictureReviewStatusEnum pictureReviewStatusEnum : PictureReviewStatusEnum.values()) {
            if (pictureReviewStatusEnum.value.equals(value))
                return pictureReviewStatusEnum;
        }

        return  null;
    }


}
